home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14246 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: mn5.swip.net!news
  2. From: tomas.jansson@mbox201.swipnet.se (Tomas Jansson)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: dynamic arrays using char with far pointers
  5. Date: 29 Mar 1996 15:06:59 GMT
  6. Organization: -
  7. Message-ID: <4jguaj$oq0@mn5.swip.net>
  8. References: <4jcg4l$18hq@news.missouri.edu>
  9. NNTP-Posting-Host: dialup115-2-2.swipnet.se
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. NNTP-Posting-User: cda9f056754bf9b500041a0d5a9124a7
  13. X-Newsreader: WinVN 0.99.6
  14.  
  15. On Mar 26, 1996 Chris Vogel(c576537@mizzou1.missouri.edu) wrote:
  16.  
  17. >
  18. >I'm converting some code I have out of a book to C++.  I'm converting a 
  19. >structure to a class(kind of logical :) ).  The structure has:
  20. >
  21. >        char far *buffer;
  22. >
  23. >Now, I thought that to initialize it, it would be:
  24. >
  25. >        buffer = new char[size];
  26. >
  27. >but that gives me a run time error.  So, I changed it to:
  28. >
  29. >        buffer = new (char far *)[size];
  30. >
  31.  
  32. If you want to make a far pointer to your dynamic memory you must write
  33.  
  34.     buffer = (char far *)new char[size];
  35.  
  36.  
  37. /Tomas Jansson
  38.  
  39.